//
//  PrescriptionOrderDetail.swift
//  EyeVisionForPatients
//
//  Created by PMC on 2021/8/11.
//  Copyright © 2021 QDSG. All rights reserved.
//

import HandyJSON

enum PrescriptionOrderDetailSectionMode {
    case receiveType, address, patientInfoForPay, drugs, drugAdvice, doctorInfoForPay, patientInfoForDetail, medicalRecordNo, doctorInfoForDetail, orderStatus
}

/// 处方药收货方式
enum PrescriptionOrderReceiveType: Int, HandyJSONEnum {
    /// 快递
    case express   = 1
    /// 药店自取
    case drugstore = 2
    /// 医院自取
    case hospital  = 3
    
    case unknown
    
    var payBtnTitle: String {
        switch self {
        case .unknown: return ""
        case .express: return "支付"
        default: return "下单"
        }
    }
    
    var toastMsg: String? {
        switch self {
        case .drugstore: return "已下单，请去药店自取"
        case .hospital:  return "已下单，请去医院自取"
        default:         return nil
        }
    }
    
    var wayText: String {
        switch self {
        case .express:  return "物流配送"
        case .hospital: return "到院自取"
        default:        return ""
        }
    }
}

struct PrescriptionOrderDetailSection {
    var mode: PrescriptionOrderDetailSectionMode
    var orderDetail: PrescriptionOrderDetail = PrescriptionOrderDetail()
}

struct PrescriptionOrderDetail: HandyJSON {
    struct SubDiagnoseModel: HandyJSON {
        /// 次诊断-前缀
        var preAppend: String?
        /// 次诊断
        var icd: String?
        /// 次诊断-后缀
        var tailAppend: String?
        /// 次诊断-前缀id
        var preAppendId: String?
        /// 次诊断-诊断id
        var icdId: String?
        /// 次诊断-后缀id
        var tailAppendId: String?
    }
    
    var openDoctorSignImg : String?
    var auditorSignImg : String?
    
    var doctorId: String?
    var patientId: String?
    /// 医生建议
    var diagnoseAdvice: String?
    var doctorName: String?
    var express: String?
    var expressNum: String?
    var hospitalName: String?
    var hospitalPhone: String?
    /// 医院地址 - 暂时没有
    var hospitalAddress: String?
    var medicalId: String?
    
    var orderId: String?
    var patientAge: String?
    var patientName: String?
    var patientSex: String?
    
    
    
    /// 科室
    var openDoctorDept :String?
    /// 配药时间
    var compoundTime : String?
    /// 发药时间
    var distributeTime : String?
    /// 开方时间
    var createTime : String?
    /// 审核时间
    var passTime : String?
    /// 身份证
    var patientIdcard : String?
    
    
    /// 初步诊断
    var preDiagnose: String?
    /// 处方id
    var preId: String?
    /// 处方时间
    var preTime: String?
    /// 订单金额
    var prescriptionAmount: String?
    /// 收货人id
    var receiverId: String?
    /// 收货人地址
    var receiverAddress: String?
    /// 收货人姓名
    var receiverName: String?
    /// 收货人电话
    var receiverPhone: String?
    /// 剩余支付时间（分）
    var remainPayTime: String = "0"
    var remark: String?
    
    var cardType: Int = 0
    
    /// 主诊断-前缀
    var preAppend: String?
    var preAppendId: String?
    /// 主诊断
    var icd: String?
    var icdId: String?
    /// 主诊断-后缀
    var tailAppend: String?
    var tailAppendId: String?
    
    var westernNameDtoList: [DrugsModel]?
    /// 次诊断数组
    var secondList: [SubDiagnoseModel]?
    
    /// 订单状态
    var status: PrescriptionOrderStatus?
    var statusName: String?
    /// 收货方式
    var receiveType: PrescriptionOrderReceiveType = .unknown
    /// 药品来源 0-院内 1-国药
    var type: Int = 0
    
    /// 配药药师姓名
    var compoundDoctorName: String?
    /// 发药药师姓名
    var distributeDoctorName: String?

    var payTime: String?
    var receiveTime: String?
    var applyBackTime: String?
    var backFinishTime: String?
    var cancelTime: String?
    var deliveryTime: String?
    /// 退药快递单号
    var backWaybillNo: String?
    var rejectBack: String?
    
    ///  快递费
    var emsFee: Double = 0.00
    /// 个人支付
    var totalAmount: String?
    /// 医保支付
    var discountAmout: String?
    /// 记账金额
    var recPayAmout: String?
}
